//
//  AppDelegate.m
//  DTest
//
//  Created by wangrui on 14-5-12.
//  Copyright (c) 2014年 PPS. All rights reserved.
//

#import "AppDelegate.h"

#import "Library.h"
#import <Framework/Framework.h>
#import "StaticLibrary.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    self.window.rootViewController = [UIViewController new];
    [self.window makeKeyAndVisible];
    
    /*
     * 该工程只能在模拟器上运行,几个库都是用模拟器编的，不支持真机
     * 注意要把动态库拷进相关目录
     *
     * 关于怎样制作动态库,参考:http://blog.csdn.net/o_surface_o/article/details/17025965 和  Dynamic_master 这个工程
     */
    
    /*
     *main 函数之前 两个动态库都已经载入内存(可以用ImageLoader查看载入的库). mac上可以共享(mac 的动态库可放入/usr/local/lib 共享)，
     *iphone上需要苹果签名才可以共享，
     *要不然只能设置到沙盒里，同样要增加app大小，但是是动态的. (注意：这两个库编译时指定的路径是app执行路径，所以要把二进制库文件拷到这个路径)
     */
    [[Library new] sayHello];
    
    
    //framework 比 dylib 方便的是:可以加入资源，头文件不用单独给出，都在framework里
    [[Framework new] sayHello];
    

    //静态库直接和app代码编译成了一个二进制文件，不存在动态载入二进制文件问题 ImageLoader也没有输出
    //静态库只要链接出现问题，整个程序编译不过. 但动态库可以通过，程序运行时才调用相关代码，增加了风险
    [[StaticLibrary new] sayhello];
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
